/*****************************************/
/**				fs.h by doom119			 */
/**				   June, 2010			 */
/*****************************************/
#ifndef _FS_H_
#define _FS_H_
#include <task.h>

#define BLOCK_SIZE 1024

struct buffer_head
{
	char *data;
	unsigned long blocknr; // which block of disk that this buffer_head represents 
	unsigned short dev;
	unsigned char uptodate; // Is data  available?
	unsigned char dirt; 	// Has data been modified?
	unsigned char count;	// How many users is using this data?
	unsigned char lock;		// Has this data been locked?
	struct task *wait;
	struct buffer_head *prev;	// the previous data in hash table
	struct buffer_head *next;	// the next data in hash table
	struct buffer_head *prev_free;	// the previous data in free list
	struct buffer_head *next_free;	// the next data in free list
};

struct d_inode
{
	unsigned short i_mode;
	unsigned short i_uid;
	unsigned long i_size;
	unsigned long i_time;
	unsigned char i_gid;
	unsigned char i_nlinks;
	unsigned short i_zone[9];
};

struct m_inode 
{
	unsigned short i_mode;
	unsigned short i_uid;
	unsigned long i_size;
	unsigned long i_mtime;
	unsigned char i_gid;
	unsigned char i_nlinks;
	unsigned short i_zone[9];
	struct task * i_wait;
	unsigned long i_atime;
	unsigned long i_ctime;
	unsigned short i_dev;
	unsigned short i_num;
	unsigned short i_count;
	unsigned char i_lock;
	unsigned char i_dirt;
	unsigned char i_pipe;
	unsigned char i_mount;
	unsigned char i_seek;
	unsigned char i_update;
};

struct file
{
	unsigned short f_mode;
	unsigned short f_flags;
	unsigned short f_count;
	struct m_inode * f_inode;
	off_t f_pos;
};

#endif
